﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YiLe.DataForms;

namespace YiLe.UI
{
    public class CustomersFolder : ApplicationFolder
    {
        private const string cFolderName = "Customers";

        public CustomersFolder()
        {
            mFolderName = cFolderName;
            this.mSupportedFeatures = FolderFeatures.All;
            this.ImageKey = "Customers";
            this.mEditImageKey = "EditCustomer";
            this.mNewImageKey = "NewCustomer";
        }

        protected override Type GetTypeOfView(ApplicationFolder.ContentViewType viewType)
        {
            switch (viewType)
            {
                case ContentViewType.GridView:
                    return typeof(CustomersGridEXView);
                default:
                    return base.GetTypeOfView(viewType);
            }
        }

        protected override DataProvider CreateDataProvider()
        {
            return new CustomersDataProvider();
        }

        public override void AddNew()
        {
            CustomerDataForm frmNew = new CustomerDataForm();
            frmNew.Edit(null);
        }

        public override bool CanAdd
        {
            get { return true; }
        }

        protected override Type GetPreviewControlType
        {
            get
            {
                return typeof(CustomerDataControl);
            }
        }

    }
}
